package com.lnsf.bookstore.system.userCoupon.controller;

import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.system.coupon.vo.Coupon;
import com.lnsf.bookstore.system.userCoupon.service.UserCouponService;
import com.lnsf.bookstore.system.userCoupon.vo.UserCoupon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/usercoupon")
public class UserCouponController {

    @Autowired
    private UserCouponService userCouponService;

    /**
     * 查看用户所有优惠券列表
     */
    @RequestMapping(value = "/list",method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public Object queryByUid(@RequestParam Map<String, Object> params) {
        PageInfo<UserCoupon> pageInfo = userCouponService.queryAll(params);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",pageInfo);
        map.put("params",params);
        return map;
    }
}
